package com.zuoye.day19;


import java.util.Arrays;
import java.util.List;

interface A{
    public void fun();
}
interface B{
    public void fun2(int x,String y);
}

interface C{
    public int fun3(int j,float s);
}

interface D{
    public void fun4(int a);
}

public class LambdaDemo {
    public static void main(String[] args) {
        A a = ()-> System.out.println("fun1..");
        a.fun();



        B b = (x,y)->{
            System.out.println("x:" + x);
            System.out.println("y:" + y);
        };
        b.fun2(10,"code");


        C c =(q,w) -> 2*q;
        int result = c.fun3(10,9.9f);
        System.out.println(result);

        D d1 = (x) -> System.out.println(x);  //lambda表达式
        D d2 = System.out::println;   //方法引用的写法
        d2.fun4(40);

        List<String> mList = Arrays.asList("1111","2222","333");
        mList.forEach(System.out::println);  //遍历出集合中每个元素





    }


}


